<!DOCTYPE html>
{% load static %}
<html lang="zh-cn">
<head>
    <script type='text/javascript' src="static/fybjs/htmlAceControlShow.js"></script>
    <script>
        headLoadFile('长安大学汽车学院物流工程系');
    </script>
    <!--付颖斌的js文件-->
    <script type='text/javascript' src="static/fybjs/httpDataTransFyb.js"></script>
    <script>
        $.ajaxSetup({data:{csrfmiddlewaretoken:'{{ csrf_token }}'}})
    </script>

</head>
<body class="no-skin">

<div class="main-container">
    <div class="main-content">
        <div class="row">
            <div class="col-sm-10 col-sm-offset-1">
                <div class="login-container">
                    <div class="center">
                        <h1>
                            <i class="ace-icon fa fa-leaf green"></i>
                            <span class="red">物流工程系练习系统</span>
                            <span class="white" id="id-text2">用户登录</span>
                        </h1>
                    </div>
                    <div class="space-6"></div>
                    <div class="position-relative">
                        <div id="login-box" class="login-box widget-box no-border visible">
                            <div class="widget-body">
                                <div class="widget-main">
                                    <h4 class="header blue lighter bigger">
                                        <i class="ace-icon fa fa-coffee green"></i>
                                        请输入账号信息
                                    </h4>
                                    <div class="space-6"></div>
                                    <form id="loginForm" name="userForm" autocomplete="on" onsubmit="return false;">
                                        <fieldset>
                                            <label class="block clearfix">
                                                                    <span class="block input-icon input-icon-right">
                                                                        <input id="form-userName-1" name="username" type="text" class="form-control" placeholder="用户名">
                                                                        <i class="ace-icon fa fa-user"></i>
                                                                    </span>
                                            </label>
                                            <label class="block clearfix">
                                                                    <span class="block input-icon input-icon-right">
                                                                        <input id="form-userPassword-2" name="password" type="password" class="form-control" placeholder="密码">
                                                                        <i class="ace-icon fa fa-lock"></i>
                                                                    </span>
                                            </label>

                                            <div style="display: none">
                                                <label class="block clearfix ">
                                                                        <span class="block input-icon input-icon-right">

                                                                        </span>
                                                </label>
                                            </div>
                                            <div class="space"></div>

                                            <div class="clearfix" style="text-align: center">
                                                <button id="submit" type="submit" class="width-35 btn btn-sm btn-primary">
                                                    <i class="ace-icon fa fa-key"></i>
                                                    <span class="bigger-110">登录</span>
                                                </button>
                                            </div>
                                        </fieldset>
                                    </form>
                                </div><!-- /.widget-main -->
                            </div><!-- /.widget-body -->
                        </div>

                    </div>
                    <!-- /.position-relative -->
                </div>


            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->
    </div>
    <!-- /.main-content -->
    <script>
        //labelInputShowAceFyb(['测试','form-field-fyb-1'],['text','form-field-fyb-1','填写背景说明','col-xs-10 col-sm-5'],['','']);
    </script>

    <script>
        //写登录按钮事件
        btnn=document.getElementById("submit");
        btnn.onclick =function(){//按钮点击事件
            var userName=document.getElementById("form-userName-1").valueOf().value;
            var userPassword=document.getElementById("form-userPassword-2").valueOf().value;
            var transData= {
                userAccount:userName,
                userPass:userPassword,
            };
            $.ajax({
                url:'userLogin',
                type:'POST',
                data:transData,
                async: false,
                timeout: 5000,
                success:function(data){
                    bakData=JSON.parse(data);
                    if(bakData['loginState']=='success')
                    {
                        //alert(bakData['csrftokenfyb'])
                        var userEntitySession = {
                            userAccount:userName,
                            csrftokenfyb: bakData['csrftokenfyb'],
                            userName:bakData['userName'],
                            enterAccount:bakData['enterAccount'],
                            userAuth:bakData['userAuth'],
                        };
                        sessionStorage[userSessionName] = JSON.stringify(userEntitySession);
                        //window.location.href='index.html';
                        window.location.href=bakData['locUrl'];
                    } else{
                        alert('用户名或密码错误，请重新输入！');
                    }
                },
            });
            //alert(bakData);
        };

    </script>
    <!--footer,显示版权信息-->
    <script>
        copyRightAceFyb('长安大学汽车学院物流工程系', 'https://qiche.chd.edu.cn/2020/1208/c8529a173474/page.htm/', '2021');
    </script>
</div>



</body>
</html>